<?php
session_start();
/*\
 *	oh.auth.interface.php
 *	---------------------
 *	name: auth
 *	desc: this module provide manage a configuration system
 *	hash: 
 *	date: 24-09-2010
\*/	oh_module_header();

# main function
function oh_function_auth($m) {	
	return oh_this();
} 
	
#module main class
class oh_class_auth {
	function oh_class_auth() {
		oh("dmodel")->new_class("user",array(
			
		));
		$this->register("admin","admin");
	}
	function is_logged() {
		$logged = false;
		if (isset($_SESSION["oh-auth"]["logged"])) {
			$logged = $_SESSION["oh-auth"]["logged"];
		}
		return $logged;
	}
	function login($user,$pass){
		$_SESSION["oh-auth"]["logged"] = true;
		return true;
	}
	function logout(){
		unset($_SESSION["oh-auth"]);		
	}
	function register($user,$pass) {
		$hashpass = md5($pass);
		oh("dmodel")->new_object("user&uniq=$user&pass=$hashpass");
	}
}
